package com.sishu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sishu.pojo.Locationlibrary;
import org.apache.ibatis.annotations.Select;

import java.util.List;


public interface LocationlibraryMapper extends BaseMapper<Locationlibrary> {


    @Select("SELECT * FROM locationlibrary WHERE location_id = #{locationId}")
    Locationlibrary selectbylocationid(int locationId);

    @Select("SELECT * FROM locationlibrary WHERE location_id = #{locationId}")
    List<Locationlibrary> selectbylocation(int locationId);


    @Select("SELECT * FROM locationlibrary")
    List<Locationlibrary> selectallground();

    @Select("SELECT * FROM locationlibrary WHERE location_type = #{locationType}")
    List<Locationlibrary> selectbylocationtype(String locationType);

    //两表连结,获取当前组已经购买的种类是sitetype的地盘
    @Select("select * from Locationlibrary m join shapanhe.locationrecord r on m.location_id=r.location_id where r.group_id = #{groupId} and location_type=#{locationType}")
    List<Locationlibrary> selectPurchasedground1(String groupId, String locationType);

    //两表连结,获取当前组当前用户的已经购买的种类是sitetype的地盘
    @Select("select * from Locationlibrary m join shapanhe.locationrecord r on m.location_id=r.location_id where r.group_id = #{groupId} and r.s_id=#{sId} and location_type = #{locationType}")
    List<Locationlibrary> selectPurchasedground2(String sId, String groupId, String locationType);

    //两表连结,获取当前组当前用户的已经购买的种类是sitetype的地盘
    @Select("select * from Locationlibrary m join shapanhe.locationrecord r on m.location_id=r.location_id where r.group_id = #{groupId} and r.s_id=#{sId} ")
    List<Locationlibrary> selectPurchasedground3(String sId, String groupId);
}
